#pragma once

#include <iostream>
#include <string>
#include <functional>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/wait.h>

typedef std::function<void(int, struct sockaddr_in)> task_func;

class Task
{
public:
    Task() {}

    Task(task_func func, int sock, struct sockaddr_in sock_cli)
        : _func(func), _sock(sock), _sock_cli(sock_cli)
    { }

    int operator()()
    {
        _func(_sock, _sock_cli);
        // std::cout << _x << " + " << _y << " = " << ret << std::endl;
    }

private:
    task_func _func;
    int _sock;
    struct sockaddr_in _sock_cli;
};